package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.FinancingProduct;
import service.FinancingProductService;
import service.impl.FinancingProductServicImpl;

@WebServlet("/SelectFinProServlet")
public class SelectFinProServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		String id =request.getParameter("id");
		String risk  =request.getParameter("risk");
		
		/*Integer _risk =-1;
		if(risk!=null && risk.length()>0) {
			_risk = Integer.parseInt(risk);
		}*/
		String currPage =request.getParameter("currPage");
		if(null == currPage || currPage.length()<0) {
			currPage="0";
		}
		Integer _currPage = Integer.parseInt(currPage);
		int pageSize =2;
		
		
		//调用service方法执行查询
		FinancingProductService fpService = new FinancingProductServicImpl();
		//查全部
		List<FinancingProduct> list = fpService.getAllFinancingProduct(id,risk);
		//放request
		request.setAttribute("list", list);
		//页面跳转
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
